package test;

public class GetTriggerTime {
	public int[] getTriggerTime(int[][] increase, int[][] requirements) {
		int[] ret = new int[requirements.length];
		int C = 0;
		int R = 0;
		int H = 0;
		int len = increase.length;
		for(int i=0 ; i<len ; i++) {
			C += increase[i][0];
			R += increase[i][1];
			H += increase[i][2];
			int lenReq = requirements.length;
			for(int j=0 ; j<lenReq ; j++) {
				if( ret[j]==0 ) {
					if( C>=requirements[j][0] && R>=requirements[j][1] && H>=requirements[j][2]) {
						ret[j] = i+1;
					}
				}
			}
		}
		for(int i=0 ; i<requirements.length ; i++) {
			if( ret[i]==0 ) ret[i]=-1;
		}
		return ret;
    }
}
